
cc.Class({
    extends: cc.Component,

    properties: {
        leftButton:{
            default:null,
            type:cc.Node,
        },
        rightButton:{
            default:null,
            type:cc.Node,
        },
        pageView:{
            default:null,
            type:cc.Node,
        }
    },

    // LIFE-CYCLE CALLBACKS:

    // onLoad () {},

    start () {

    },
    pressLeftButton(){
        let pageNum = this.pageView.getComponent(cc.PageView).getCurrentPageIndex()
        if(pageNum>0){
            this.pageView.getComponent(cc.PageView).setCurrentPageIndex(pageNum-1)
        }
    },
    pressRightButton(){
        let pageNum = this.pageView.getComponent(cc.PageView).getCurrentPageIndex()
        if(pageNum<2){
            this.pageView.getComponent(cc.PageView).setCurrentPageIndex(pageNum+1)
        }
    }
    // update (dt) {},
});
